package cn.itcast.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect

public class RuntimeMonitorAspect {

    @Around("execution(* cn.itcast..*.*(..))")
    public Object pt(ProceedingJoinPoint pjp)throws Throwable{

        long l1 = System.currentTimeMillis();
        Object proceed = pjp.proceed(pjp.getArgs());
        long l2 = System.currentTimeMillis();

        System.out.println("用时:"+(l2-l1));
        return proceed;
    }
}
